Acceleration = sample{1}.Acceleration;
t = linspace(0,height(Acceleration)/100,height(Acceleration));
a = timetable2table(Acceleration);
accelData = [a.X a.Y a.Z]';
plot(t,accelData(1,:), 'r')
title({strcat('File: ',sample{1}.Source(1:end-4));"\fontsize{8}\itPrinthead acceleration over time (X)"})
plot(t,accelData(2,:), 'g')
title("\fontsize{8}\itY Axis acceleration")
plot(t,accelData(3,:), 'b')
title("\fontsize{8}\itZ Axis Acceleration)")
ylabel("Acceleration (m/s^2)")
accelData = [a.X a.Y a.Z]';
plot(t,x, 'Color', [99, 64, 199]./255)
title("\fontsize{8}\itAcceleration Magnitude")
[success, level] = classify_accel_threshold(x);
plot([0 length(x)/100], [15 15], 'g')
legend('Acceleration (m/s^2)', strcat(string(round(level,2)),'<15 m/s^2 max (indicates success)'), 'Location', 'bestoutside')
plot([0 length(x)/100], [15 15], 'r')
legend('Acceleration (m/s^2)', strcat(string(round(level,2)),'>15 m/s^2 max (indicates FAIL)'), 'Location', 'bestoutside')
set(gcf, 'color', [1 0.4 0.4])
Fs = 100; % sampling rate of 100Hz
f = linspace(-Fs/2, Fs/2 - Fs/N, N) + Fs/(2*N)*mod(N, 2);
fftOutput = fftshift(abs(FA));
plot(f,fftOutput,'Color',[0 0 0]./255);
title("signal FFT of print segment (All axes)")
sampleLength = length(fftOutput);
normalizedSample = fftOutput./sampleLength;
[success, level] = classify_fft_threshold(normalizedSample, 0.018);
plot([-50 50], ones(2)*0.018*sampleLength, 'g')
legend('Power (normalized scalar)', strcat(string(round(level,2)),'<0.018 normalized max (indicates success)'), 'Location', 'bestoutside')
plot([-50 50], ones(2)*0.018*sampleLength, 'r')
legend('Power (normalized scalar)', strcat(string(round(level,2)),'>0.018 normalized max (indicates FAIL)'), 'Location', 'bestoutside')
% set(gcf, 'color', [1 0.4 0.4])
d = round(length(fftOutput)/2);
halfFFToutput = fftOutput(d:end);
% plot(halfF,halfFFToutput);
p = polyfit(halfF,halfFFToutput,1);
plot(halfF,polyval(p,halfF),'g','LineWidth',2.0,'DisplayName',strcat('Half-FFT Fit Line, m=',string(round(p(1),2)),'>0.7 m/s (success)'))
plot(halfF,polyval(p,halfF),'r','LineWidth',2.0,'DisplayName',strcat('Half-FFT Fit Line, m=',string(round(p(1),2)),'<0.7 m/s (FAIL)'))
saveas(gcf, strcat('./imgs/',sample{1}.Source(1:end-4),'.png'))
toc
Elapsed time is 26.361364 seconds.
Acceleration = sample{1}.Acceleration;
t = linspace(0,height(Acceleration)/100,height(Acceleration));
a = timetable2table(Acceleration);
accelData = [a.X a.Y a.Z]';
% plot(t,accelData(1,:), 'r')
% plot(t,accelData(2,:), 'g')
% title("\fontsize{8}\itY Axis acceleration")
% plot(t,accelData(3,:), 'b')
% title("\fontsize{8}\itZ Axis Acceleration)")
% ylabel("Acceleration (m/s^2)")
accelData = [a.X a.Y a.Z]';
% plot(t,x, 'Color', [99, 64, 199]./255)
% title("\fontsize{8}\itAcceleration Magnitude")
[success, level] = classify_accel_threshold(x);
% plot([0 length(x)/100], [15 15], 'g')
% legend('Acceleration (m/s^2)', strcat(string(round(level,2)),'/15 m/s^2 max (indicates success)'), 'Location', 'bestoutside')
plot([0 length(x)/100], [15 15], 'r')
% legend('Acceleration (m/s^2)', strcat(string(round(level,2)),'/15 m/s^2 max (indicates FAIL)'), 'Location', 'bestoutside')
% set(gcf, 'color', [1 0.4 0.4])
Fs = 100; % sampling rate of 100Hz
f = linspace(-Fs/2, Fs/2 - Fs/N, N) + Fs/(2*N)*mod(N, 2);
fftOutput = fftshift(abs(FA));
plot(f,fftOutput,'Color',[99 64 199]./255);
title({strcat('File: ',sample{1}.Source(1:end-4));"\fontsize{8}\itSignal FFT of print segment (All axes) with analysis"})
sampleLength = length(fftOutput);
normalizedSample = fftOutput./sampleLength;
[success, level] = classify_fft_threshold(normalizedSample, 0.018);
plot([-50 50], ones(2)*0.018*sampleLength, 'g')
legend('Power (normalized scalar)', strcat(string(round(level,2)),'<0.018 normalized max (indicates success)'), 'Location', 'best')
plot([-50 50], ones(2)*0.018*sampleLength, 'r')
legend('Power (normalized scalar)', strcat(string(round(level,2)),'>0.018 normalized max (indicates FAIL)'), 'Location', 'best')
% set(gcf, 'color', [1 0.4 0.4])
d = round(length(fftOutput)/2);
halfFFToutput = fftOutput(d:end);
% plot(halfF,halfFFToutput);
p = polyfit(halfF,halfFFToutput,1);
plot(halfF,polyval(p,halfF),'g','LineWidth',2.0,'DisplayName',strcat('Half-FFT Fit Line, m=',string(round(p(1),2)),'>0.7 m/s (success)'))
plot(halfF,polyval(p,halfF),'r','LineWidth',2.0,'DisplayName',strcat('Half-FFT Fit Line, m=',string(round(p(1),2)),'<0.7 m/s (FAIL)'))
saveas(gcf, strcat('./imgs/fourier/',sample{1}.Source(1:end-4),'.png'))